package org.collab_games.engine.wrappers;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;

public class Triangle {
Vector3 point1, point2, point3;
Color color;

public Triangle(Vector3 point1, Vector3 point2, Vector3 point3) {
	this.point1 = point1;
	this.point2 = point2;
	this.point3 = point3;
}

public Triangle(Line points1And2, Vector3 point3) {
	this.point1 = points1And2.point1;
	this.point2 = points1And2.point2;
	this.point3 = point3;
}

public void draw (Graphics g, double zoom, Dimension viewport) {
	Color c1 = g.getColor();
	g.setColor(color);
	Vector2 pointA = point1.flatten(zoom, viewport), pointB = point2.flatten(zoom, viewport), pointC = point3.flatten(zoom, viewport);
	g.fillPolygon(new int[]{pointA.x, pointB.x, pointC.x}, new int[]{pointA.y, pointB.y, pointC.y}, 3);
	g.setColor(c1);
}

public void draw(Graphics g, double zoom, Dimension viewport, Color color) {
	Color c1 = g.getColor();
	g.setColor(color);
	Vector2 pointA = point1.flatten(zoom, viewport), pointB = point2.flatten(zoom, viewport), pointC = point3.flatten(zoom, viewport);
	g.fillPolygon(new int[]{pointA.x, pointB.x, pointC.x}, new int[]{pointA.y, pointB.y, pointC.y}, 3);
	g.setColor(c1);
}
}
